home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
-
-
-
-
-
-
- ==================================================================
- EEEEEEE MM MM IIIIIII L Y Y 5555555 22222
- E M M M M I L Y Y 5 2 2
- E M M M I L Y Y 555555 2
- EEEE M M I L Y --- 5 22222
- E M M I L Y 5 2
- E M M I L Y 5 5 2
- EEEEEEE M M IIIIIII LLLLLLL Y 55555 2222222
- ==================================================================
-
-
-
-
-
- A
- Simulator/Emulator
- for the
- 8051 and 8052
-
-
-
-
-
- Release 1.3
-
- Revised 04-Jan-94
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Copyright 1991-1994 Dave Dunfield
- All rights reserved
- EMILY: An 8051/52 simulator Page: 1
-
-
- 1. INTRODUCTION
-
- EMILY is a software simulator for the 8051 and 8052 families of
- processors. It provides a powerful debugging environment, offering
- many features:
-
- - Supports full 64K of PROGRAM and 64K of DATA memory. DATA and
- PROGRAM memory may also be overlapped into a single 64K address
- space.
-
- - Hardware emulation mode communciates with the target system, and
- allows you to include the physical I/O lines, timers etc. in your
- simulation.
-
- - Single step, Multi Step, Animate and Full Speed execution modes.
-
- - Simultanious on-screen displays of program disassembly, internal
- memory, CPU registers and simulation messages.
-
- - Full screen editors for CPU registers, Special Function Registers
- (SFR's), and each of the INTERNAL, EXTERNAL DATA and PROGRAM memory
- spaces. All of the above may be viewed/altered at any time during
- the debugging session.
-
- - Multiple breakpoints are transparent to the user program.
-
- - Supports the additional SFR's and internal RAM of the 8052 series.
-
- 1.1 System Requirements
-
- EMILY will run on any IBM PC/AT/PS2 compatible system with a
- MDA/CGA/EGA or VGA display, two COMM ports, and at least 192K of
- free system RAM.
-
- - If hardware emulation or serial I/O are not used, only one COMM
- port is required.
-
- - If Overlapped data/program memory is used, only 128K of free ram
- is required.
-
- - Some CGA displays may exibit "snow" or flicker during high speed
- screen updates. This effect will not occur with MDA, EGA or VGA
- displays.
- EMILY: An 8051/52 simulator Page: 2
-
-
- 2. STARTING UP EMILY
-
- If you are using the optional hardware emulation mode, insure that
- the resident control software (supplied) is inserted into the target
- system, and that the PC running EMILY is connected to the target
- systems serial port via COM2. Power on the test system before
- starting EMILY. The resident control software must be active when
- EMILY "looks" for it.
-
- EMILY is invoked by typing her name at the DOS command line. You
- will be greeted with a "welcome" screen which displays a reminder of
- the command line syntax and the copyright message. This screen will
- remain on the display for about 5 seconds (10 seconds in the demo
- version). Pressing any key while this screen is visible will bypass
- this delay, and proceed directly to the main control panel.
-
- If EMILY is given a file name on the command line, she loads it in
- the same manner as if the 'L'oad command had been used from within
- the main control panel.
- EMILY: An 8051/52 simulator Page: 3
-
-
- EMILY also accepts several option switches on the command line:
-
- /Hardware[:n] - Enables the hardware emulation feature to cause
- EMILY to interact with the target system when
- performing I/O accesses. This option may be
- followed by a ':' and a numeric value which
- defines the BAUD RATE to be used to communicate
- with the target system. Default is 28800.
-
- /Mono * - Inhibits the color display, even if a color
- adapter is present. This option may be useful
- if your monitor/adapter combination provides an
- unpleasent or unusable display for EMILY.
-
- /Overlap - Joins EXTERNAL DATA and PROGRAM memory into a
- single 64K address space which can be accessed
- with either MOVX or MOVC. This is equivalent to
- a hardware implementation in which the PSEN and
- RD signals are ANDed together.
-
- /Reset - Causes EMILY to de-assert the RTS line when she
- initializes the serial port. This option may be
- required when using EMILY with older versions
- of our "BD52" single board computer.
-
- /Swapcom - Exchanges the operation of the two serial ports
- on the PC. When this option is used, COM1 will
- be used to communicate with the target system,
- and COM2 is used for serial I/O redirection.
-
- * Note: If some of the EMILY windows appear to be an un-readable
- washed-out yellow color, try adjusting the color contrast on
- your monitor. Those windows should be an easy to read brown.
-
- If you are using the '/Hardware' option, and EMILY is unable to
- establish communication with the target system, you will see an error
- message flashing on the screen. EMILY will keep trying, allowing you
- to debug the connection. You may also press the ESCAPE key to disable
- hardware emulation, and proceed with a software only simulation.
- EMILY: An 8051/52 simulator Page: 4
-
-
- 3. USING EMILY
-
- 3.1 The Main Control Panel
-
- Once EMILY is up and running, you will be presented with the
- "Main Control Panel", which consists of four "windows" displaying:
-
- - A disassembly of program memory (Upper LEFT)
- - The contents of CPU registers (Upper CENTER)
- - The contents of INTERNAL MEMORY (Upper RIGHT)
- - Informational messages from EMILY (Lower portion)
-
- All of EMILY'S functions are accessed by command characters
- entered from this screen:
-
- 3.1.1 A - Animate execution
-
- This function begins execution of the user program (from the
- address in the PC register). As each instruction is executed,
- EMILY will display the instruction being executed, the CPU
- registers, and the contents of internal RAM in the appropriate
- windows.
-
- When you enter the 'A' command, EMILY will prompt you for
- the number of instructions to animate. Pressing return (without
- entering a number) will cause the animation to proceed
- non-stop. Pressing <escape> will return you to the Main Control
- Panel.
-
- The animation will terminate when:
-
- - The requested number of instructions have been stepped.
- - A breakpoint is encountered.
- - The illegal opcode ($A5) is encountered.
- - The <escape> key is pressed on the PC console.
-
- 3.1.2 B - set Breakpoint
-
- This command sets a breakpoint such that program execution
- under the 'A'nimate, or 'G'o, commands will stop when the
- breakpoint address is encountered.
-
- Up to 10 breakpoints may be in effect at the same time.
-
- You will be prompted for the address (in HEX). Pressing
- return (without entering an address) will cause the breakpoint
- to be set at the current program counter (PC) location.
- Pressing <escape> will return you to the main control panel.
-
- EMILY stores the breakpoint addresses internally in a simple
- zero terminated list. This allows her to avoid searching a
- fixed size table, and helps speed up the operation of the
- program, especially when there are few breakpoints. This does
- however cause the restriction that you cannot set a breakpoint
- at address zero ($0000).
- EMILY: An 8051/52 simulator Page: 5
-
-
- 3.1.3 C - Change register
-
- You will be prompted for the CPU register to change. Enter a
- character from the following list, ESCAPE to abort, or F1 for a
- reminder:
-
- A - A accumulator
- B - B accumulator
- D - Data pointer (DPTR)
- S - Stack pointer
- P - Program counter
- W - processor status Word
- 0-7 - general register 0-7
-
- After you have selected the register, you will be prompted
- for the new contents (in HEX).
-
- 3.1.4 D - edit Data memory
-
- This command allows you to edit EXTERNAL DATA memory using
- EMILY's built in memory editor. See the "Memory Editor"
- section.
-
- 3.1.5 F - display/edit special Function registers
-
- The names and contents of all SFR's are displayed in a menu.
- To change a register, enter the character preceeding the ':',
- immediately to the left of its name. You will be prompted for
- its new contents.
-
- If multiple columns of SFR's are defined, use <space> to
- select the column to edit.
-
- When debugging with the hardware emulation option, the
- values read/and written to the SFR's will reflect the actual
- state of the hardware lines etc. on the target system board.
- Pressing any key while in this menu will refresh the display,
- and make visible any changes which have occured on the target
- system I/O lines etc.
-
- When debugging without the hardware emulator option, SFR's
- are simply stored internaly within EMILY's memory.
- EMILY: An 8051/52 simulator Page: 6
-
-
- 3.1.6 G - Go: execute program
-
- This function begins high-speed execution of the user
- program (from the address in the PC register).
-
- When you enter the 'G' command, EMILY will prompt you for
- the number of instructions to execute. Pressing return (without
- entering a number) will cause the program to proceed non-stop.
- Pressing <escape> will return you to the Main Control Panel.
-
- Program execution will terminate when:
-
- - The requested number of instructions have been executed.
- - A breakpoint is encountered.
- - The illegal opcode ($A5) is encountered.
- - The <escape> key is pressed on the PC console. *
-
- * NOTE: If you are using 'Local' serial I/O mode, ESCAPE offers
- you a menu of execution I/O functions. See the F3 command for
- more information.
-
- 3.1.7 I - edit Internal memory
-
- This command allows you to edit INTERNAL memory using
- EMILY's built in memory editor. See the "Memory Editor"
- section.
-
- 3.1.8 J - Jump to PC
-
- This command re-positions the disassembly display window (if
- necessary) to display the instruction addressed by the current
- CPU Program Counter (PC).
-
- 3.1.9 K - Kill all breakpoints
-
- Removes ALL breakpoints after prompting for permission to do
- so.
-
- 3.1.10 L - Load program image
-
- Prompts for the name of a file, and loads it into PROGRAM
- memory. The file must be in either INTEL or MOTOROLA hex
- download format.
-
- 3.1.11 N - Next disassembly window
-
- Advances the disassembler to display the following screen.
- Subsequent 'N' commands will proceed to disassemble higher
- memory addresses.
-
- 3.1.12 P - edit Program memory
-
- This command allows you to edit PROGRAM memory using EMILY's
- built in memory editor. See the "Memory Editor" section.
- EMILY: An 8051/52 simulator Page: 7
-
-
- 3.1.13 R - Remove a breakpoint
-
- Prompts for the address, and if a breakpoint is set at that
- address, it is removed. Pressing return (without entering an
- address) will remove the breakpoint at the current program
- counter (PC) location.
-
- 3.1.14 T - Traceback viewer
-
- In all execution modes, EMILY keeps track of the last 4095
- instructions executed. By entering the traceback viewer, you
- can examine this recording, and determine program activity up
- to 4095 instructions preceeding the one on which execution last
- stopped.
-
- The following command keys are available in the viewer:
-
- Up - Backup the display 1 instruction.
- Down - Advance the display 1 instruction.
- PgUp - Backup the display 50 instructions.
- PgDn - Advance the display 50 instructions.
- Home - Position to the beginning of recording.
- End - Position to the end of recording.
- F1 - Display a help summary.
- F2 - Prompt for position & move.
- F3 - Search backward (in time) for address. *
- F4 - Search forward (in time) for address. *
- Esc - Exit the Traceback viewer.
-
- * If you press <return> without entering an address, the search
- commands will look for the previous or next instance of the
- instruction at your current position in the traceback buffer.
-
- Only the instruction executed is saved in the traceback
- viewer, the contents of registers, RAM etc. are not recorded.
-
- The instruction at position 0 in the traceback buffer is the
- one to which the current PC points, and has not yet been
- executed.
-
- 3.1.15 V - Vector to interrupt
-
- This function prompts you with a menu of the available 8052
- interrupts. Use the arrow keys to position the cursor bar to
- the interrupt you desire to simulate, and press ENTER to select
- it. You may use ESCAPE to cancel the function and return to the
- Main Control Panel.
-
- EMILY will simulate a long call (LCALL) to the corresponding
- interrupt vector address by saving the current Program Counter
- on the CPU stack, and reloading it with the vector. Any SFR
- bits normally set when the particular interrupt occurs will be
- set at this time.
- EMILY: An 8051/52 simulator Page: 8
-
-
- 3.1.16 F1 - Help display
-
- Pressing this key displays a summary of the EMILY commands
- which are available from the Main Control Panel.
-
- 3.1.17 F2 - Set Disassembler Address
-
- Prompts for an address (in HEX), and re-positions the
- disassembler window to display instructions beginning at that
- address.
-
- 3.1.18 F3 - Setup Serial Port
-
- Opens a window displaying the (B)audrate, (P)arity, (D)ata
- bits and (S)top bits which are currently configured for the
- PC's COM1 serial port.
-
- Press B, P, D or S to cycle to the next corresponding entry.
-
- When Baudrate is selected as 'Local', EMILY will re-direct
- the programs serial accesses to the message window. Any
- characters which are written to SBUF will be output in the
- message window, and any character which are typed at the
- keyboard will appear as incomming serial data. When this mode
- is active, Pressing ESCAPE in the 'G'o command brings up a menu
- of execution options:
-
- End simulation - Stops the 'G'o command.
- Send ESCAPE - Send ESCAPE through as a charcter.
- Zoom window - Switch to full screen I/O window.
-
- If 'Local' is not selected, EMILY re-directs the programs
- serial accesses to the PC's COM1 serial port, however, for
- maximum flexibility, the actual data format used may be
- configured by this menu.
-
- EMILY allows you to "fine tune" a baud rate, by using the
- Up/Down keys. Note that the available baud rate values are
- determined by the PC COMM port hardware, and may not fall
- exactly on the value you wish to use.
-
- Asynchronous communication is specified to work properly as
- long as the device is operating within 5% of the intended baud
- rate.
-
- For example:
-
- Desired baud rate : 1500
- Allowable range (+/- 5%): 1425-1575
- Closest PC baud rate : 1496
-
- In the above example, the baud rate produced is within 0.3%
- of the desired value, and is therefore well within
- specifications.
- EMILY: An 8051/52 simulator Page: 9
-
-
- 3.1.19 <space> - Single step one instruction
-
- Every time you press the <space> bar, EMILY will execute one
- instruction, and update the on-screen displays.
-
- 3.1.20 PgDn - Advance IRAM display page
-
- Pressing this key advances the internal memory display
- window by one page (64 bytes).
-
- 3.1.21 PgUp - Backup IRAM display page
-
- Pressing this key backs up the internal memory display
- window by one page (64 bytes).
-
- 3.1.22 Down - Advance IRAM display line
-
- Pressing the "down arrow" key advances the internal memory
- display window by one line (4 bytes).
-
- 3.1.23 Up - Backup IRAM display line
-
- Pressing the "up arrow" key backs up the internal memory
- display window by one line (4 bytes).
- EMILY: An 8051/52 simulator Page: 10
-
-
- 3.2 The Memory Editor
-
- When you activate the 'D', 'I' or 'P' commands from the main
- control panel, EMILY will invoke its internal "Memory Editor" to
- access the desired memory area. When you are within this editor,
- the following commands are available:
-
- 3.2.1 F1 - Help display
-
- Pressing this key displays a summary of the EMILY commands
- which are available from within the Memory Editor.
-
- 3.2.2 F2 - Set Edit Address
-
- Prompts for an address (in HEX), and re-positions the editor
- display and cursor to edit at that address.
-
- 3.2.3 F3 - Toggle Edit Mode
-
- EMILY allows two edit modes, HEX and ASCII. When in HEX
- mode, your cursor will be positioned in the hexidecimal display
- portion of the memory memory dump, allowing you to change
- memory by entering a new value as two hexidecimal characters.
- When in ASCII mode, your cursor will be positioned over the
- ASCII portion of the dump, and you can replace memory with
- ASCII text typed at the keyboard.
-
- Pressing F3 will toggle between HEX and ASCII mode, causing
- your cursor to switch between the corresponding portion of the
- memory display.
-
- 3.2.4 Up - Move up 1 line
-
- Pressing the UP ARROW causes the cursor to move upwards on
- the screen by one line. This reduces the memory edit address by
- 16 bytes.
-
- 3.2.5 Down - Move down 1 line
-
- Pressing the DOWN ARROW causes the cursor to move downwards
- on the screen by one line. This increases the memory edit
- address by 16 bytes.
-
- 3.2.6 Left - Move left 1 byte
-
- Pressing the LEFT ARROW causes the cursor to move to the
- left by one byte position. This reduces the memory edit address
- by 1 byte.
-
- If the cursor is already at the left hand margin, it will
- wrap around to the rightmost position of the previous line.
- EMILY: An 8051/52 simulator Page: 11
-
-
- 3.2.7 Right - Move right 1 byte
-
- Pressing the RIGHT ARROW causes the cursor to move to the
- right by one byte position. This in increases the memory edit
- address by 1 byte.
-
- If the cursor is already at the right hand margin, it will
- wrap around to the leftmost position of the following line.
-
- 3.2.8 PgUp - Move back 1 page
-
- Pressing the PGUP key causes the editor to move back one
- display page. This reduces the memory edit address by 256
- bytes.
-
- 3.2.9 PgDn - Move forward 1 page
-
- Pressing the PGDN causes the editor to move forward one
- display page. This increases the memory edit address by 256
- bytes.
-
- 3.2.10 Home - Move to start of line
-
- Pressing the HOME key causes the cursor to move to the
- leftmost position of the line it is currently on. If the cursor
- was already in the leftmost position, it is moved to the
- leftmost position of the preceeding line.
-
- 3.2.11 End - Move to end of line
-
- Pressing the END key causes the cursor to move to the
- rightmost position of the line it is currently on. If the
- cursor was already in the rightmost position, it is moved to
- the rightmost position of the following line.
-
- 3.2.12 Ctrl-PgUp - Move to start of memory
-
- Pressing the CTRL and PGUP keys re-positions the editor
- display and cursor to address $0000 at the start of the memory
- block.
-
- 3.2.13 Ctrl-PgDn - Move to end of memory
-
- Pressing the CTRL and PGDN keys re=positions the editor
- display and cursor to the highest address available in the
- memory block.
- EMILY: An 8051/52 simulator Page: 12
-
-
- 3.3 Hardware Emulation
-
- EMILY supports a hardware emulation mode, which provides access
- to most of the physical I/O ports, timers etc. from the target
- system in your simulation.
-
- The target system must be running the supplied control
- software, which interacts with EMILY, and perform the I/O accesses
- upon her commands. The serial port of the target system must be
- connected to the COM2 serial port of the PC.
-
- There are a few restrictions which apply:
-
- - The target system must provide access to the CPU serial port.
-
- - There is an approximatly 0.7 MS delay when accessing the I/O
- ports and other physical hardware. This occurs due to the
- serial activity required to communicate the data to and from
- the target system. For most applications, this delay is
- acceptable, particularly in the stop/start environment of
- simulation and debugging. NOTE: If you are using a baudrate
- to communicate with the target system which is lower than the
- default (28800), this delay will be longer.
-
- - The control software uses TIMER1 internally to generate the
- baud rate clock for its serial port. This means that TIMER1
- is unavailable during the simulation. If your application
- uses the serial port, we recommend you also use TIMER1 as the
- baud rate generator. Since EMILY has a separate setup memu
- for serial port speed, parity etc. It will not affect your
- program that TIMER1 is disabled during the simulation. Simply
- press F3 at EMILY's main control panel, and select the serial
- parameters you desire.
- EMILY: An 8051/52 simulator Page: 13
-
-
- When using this (Hardware Emulation) feature, the Resident
- Control Firmware should be running in the target system BEFORE
- executing EMILY. Be sure to specify '/H:<speed>' parameter on the
- command line when starting EMILY.
-
- The value of <speed> depends on the target systems operating
- frequency. The following table shows the speeds which can be used
- with several common crystal frequencies without modifying the
- supplied Resident Control Firmware:
-
- Freq (Mhz) Speed -> Actual
- ----------------------------------------
- 11.0592 28800 -> 28800 0.0%
- 11.0 28646 -> 28800 0.5%
- 9.0 23438 -> 23040 1.7%
- 7.3728 19200 -> 19200 0.0%
- 5.0 13020 -> 12800 1.7%
- 4.0 10417 -> 10473 0.5%
- 3.68 9600 -> 9600 0.0%
- 3.59 9349 -> 9600 2.7%
- 3.0 7813 -> 7680 1.7%
- 2.0 5208 -> 5236 0.5%
- 1.84 4800 -> 4800 0.0%
- 1.0 2604 -> 2618 0.5%
-
- At the beginning of the supplied KERNAL.ASM file is a large
- comment which describes how to change the baud rate constant to
- obtain other serial port speeds. The following table shows speeds
- which can be used with other common crystal frequencies by
- altering the "BAUD" value in the KERNAL.ASM file:
-
- Freq (Mhz) BAUD Value Speed -> PC Speed
- ------------------------------------------------
- 12.0 3 10417 -> 10473 0.5%
- 10.0 2 13020 -> 12800 1.7%
- 8.0 2 10417 -> 10473 0.5%
- 7.0 2 9116 -> 8862 2.8%
- 6.0 2 7813 -> 7680 1.7%
- EMILY: An 8051/52 simulator Page: 14
-
-
- 3.4 Messages
-
- During the course of operation, EMILY may display the following
- messages in the message window located in the lower portion of the
- screen:
-
- 3.4.1 All Used!
-
- You have tried to enter a breakpoint, when all available
- breakpoints are in use. EMILY allows up to 10 code breakpoints
- to be active at any one time.
-
- 3.4.2 Animating at XXXX
-
- Indicates that EMILY has commenced animated execution of
- your program, beginning at the address 'XXXX'.
-
- 3.4.3 Already set!
-
- Issued to indicate that the address at which you have tried
- to set a breakpoint is already active as a breakpoint.
-
- This message will also result of you attempt to set a
- breakpoint at address zero ($0000).
-
- 3.4.4 Breakpoints: [XXXX ...]
-
- This message shows the currently set breakpoint addresses,
- and is issued whenever any command involving breakpoints is
- performed.
-
- 3.4.5 Executing at XXXX
-
- Indicates that EMILY has commenced full speed exection of
- your program, beginning at the address 'XXXX'.
-
- 3.4.6 Code and data are overlapped
-
- This message results from the use of the '/Overlap' switch
- on the EMILY command line, and indicates that the external CODE
- and DATA memory address spaces are combined into a single
- overlapping 64K segment.
-
- 3.4.7 Code and data are separate
-
- Indicate that EMILY has established separate 64K memory
- address spaces for the code and data, resulting in 128K total
- external memory.
-
- 3.4.8 FILENAME: Bad checksum
-
- EMILY has encountered a record containing a incorrect
- checksum value while attempting to 'L'oad the named file.
- EMILY: An 8051/52 simulator Page: 15
-
-
- 3.4.9 FILENAME: Demo limit exceeded!
-
- This message occurs only in the "Demonstration" version of
- EMILY, and indicates that you have attempted to 'L'oad more
- than 500 bytes of code. The demonstration release is intended
- only to allow you to check out EMILY's features, you must
- purchase the "production" version if you intend to use the
- program for serious development and debugging.
-
- 3.4.10 FILENAME: Invalid HEX record
-
- EMILY has encountered an improperly formatted download
- record while attempting to 'L'oad the named file.
-
- 3.4.11 FILENAME: N bytes loaded
-
- The indicated number of bytes have been successfully
- 'L'oaded from the named file.
-
- 3.4.12 FILENAME: Unable to access
-
- EMILY was unable to open and read the named file.
-
- 3.4.13 Hardware emulation is disabled
-
- Indicates that the EMILY is running as a software only
- simulator, and will emulate special functions registers etc.
- using internal RAM memory.
-
- 3.4.14 Hardware emulation is enabled
-
- Issued if the "/Hardware" switch was used on the EMILY
- command line, and the Resident Control Software in the target
- system has been detected. In this mode of operation, special
- function register accesses are communicated to the control
- software, and result in physical activity on the target system.
-
- 3.4.15 Stopped at XXXX
-
- Indicates that EMILY has stopped execution of you program at
- the indicated address. This message is appended to the initial
- message indicating that execution had commenced.
-
- 3.4.16 Target system is not responding!!!
-
- Indicates that the "/Hardware" option switch was used on the
- EMILY command line, but EMILY cannot establish communication
- with the target system. EMILY will keep trying, allowing you to
- attempt to debug the connection. You may also press the ESCAPE
- key, to disable hardware emulation mode, and proceed with a
- software only simulation.
- EMILY: An 8051/52 simulator Page: 16
-
-
- 3.4.17 XXXX: Not found
-
- This message is issued while in the 'T'raceback viewer, to
- indicate that an address 'XXXX' you have searched for does not
- occur between your current position, and the start/end of the
- traceback buffer.
-
-
-
- EMILY: An 8051/52 simulator
-
- TABLE OF CONTENTS
-
-
- Page
-
- 1. INTRODUCTION 1
-
- 1.1 System Requirements 1
-
- 2. STARTING UP EMILY 2
-
-
- 3. USING EMILY 4
-
- 3.1 The Main Control Panel 4
- 3.2 The Memory Editor 10
- 3.3 Hardware Emulation 12
- 3.4 Messages 14
-